//------------Sonic CD Swing Platform Script-------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

//-------Aliases-------//
#alias 63: TYPE_SWINGPLATFORM


sub ObjectMain
	Object.Value5+=2
	Object.Value5&=511
	Sin(Object.Value0,Object.Value5)
	Object.Value0>>=2
	Object.Value0+=128
	TempValue1=Object.PropertyValue
	TempValue1++
	TempValue1<<=4
	Cos(Object.Value3,Object.Value0)
	Object.Value3*=TempValue1
	Object.Value3<<=7
	Object.Value3+=Object.XPos
	Object.Value3&=-65536
	Object.Value3-=Object.Value1
	Sin(Object.Value4,Object.Value0)
	Object.Value4*=TempValue1
	Object.Value4<<=7
	Object.Value4+=Object.YPos
	Object.Value4&=-65536
	Object.Value4-=Object.Value2
endsub


sub ObjectPlayerInteraction
	TempValue0=Object.XPos
	TempValue1=Object.YPos
	Object.XPos=Object.Value1
	Object.YPos=Object.Value2
	PlayerObjectCollision(C_PLATFORM,-24,-6,24,8)
	if CheckResult==1
		Player.XPos+=Object.Value3
		Player.YPos+=Object.Value4
	endif
	Object.XPos=TempValue0
	Object.YPos=TempValue1
endsub


sub ObjectDraw
	DrawSprite(0)
	TempValue0=0
	TempValue1=16
	while TempValue0<Object.PropertyValue
		Cos(TempValue2,Object.Value0)
		TempValue2*=TempValue1
		TempValue2<<=7
		TempValue2+=Object.XPos
		Sin(TempValue3,Object.Value0)
		TempValue3*=TempValue1
		TempValue3<<=7
		TempValue3+=Object.YPos
		DrawSpriteXY(1,TempValue2,TempValue3)
		TempValue0++
		TempValue1+=16
	loop
	Cos(Object.Value1,Object.Value0)
	Object.Value1*=TempValue1
	Object.Value1<<=7
	Object.Value1+=Object.XPos
	Object.Value1&=-65536
	Sin(Object.Value2,Object.Value0)
	Object.Value2*=TempValue1
	Object.Value2<<=7
	Object.Value2+=Object.YPos
	Object.Value2&=-65536
	DrawSpriteXY(2,Object.Value1,Object.Value2)
endsub


sub ObjectStartup
	LoadSpriteSheet("R1/Objects2.gif")
	SpriteFrame(-8,-8,16,16,173,230)
	SpriteFrame(-8,-8,16,16,190,230)
	SpriteFrame(-24,-8,48,16,207,230)
endsub

sub RSDK
	LoadSpriteSheet("Global/Display.gif")
	SetEditorIcon(Icon0,SingleIcon,-16,-16,32,32,1,143)
endsub
